<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link href="<?php echo __CONTENT__;?>/Admin/css/admin.css" rel="stylesheet"
	type="text/css">

<script type="text/javascript" src="<?php echo __CONTENT__;?>/js/jquery.js"></script>
<script type="text/javascript" src="<?php echo __CONTENT__;?>/js/jquery.validate.js"></script>
<script type="text/javascript" src="<?php echo __CONTENT__;?>/js/artDialog.js?skin=black"></script>
<script type="text/javascript" src="<?php echo __CONTENT__;?>/js/WdatePicker.js"></script>
</head>
<body>
<script type="text/javascript">
$(function(){
	$(".delete").click(function(){
		var url=$(this).attr("href");
		art.dialog({
			id:"delete",
			title:"确认删除",
			content:"您确认要删除此记录吗?",
			lock:true,
			ok:function(){
				location.href=url;
			},
			icon:"question",
			cancel:true
		});
		return false;
	});
	$("#checkAll").click(function(){
		if($(this).attr("checked")){
			$(":checkbox").attr("checked",true);
		}else{
			$(":checkbox").attr("checked",false);
		}
	});
	$("#deleteAll").click(function(){
		if($("input[name='id[]']:checked").size()!=0){
			$("form").submit();
		}else{
			art.dialog({
				id:"delete",
				title:"确认删除",
				content:"请勾选需要删除的数据",
				lock:true,
				ok:true,
				icon:"face-sad"
			});
		}
		return false;
	});
});
function show_error_message(title,msg){
	art.dialog({
		id:"id",
		title:title,
		content:msg,
		lock:true,
		ok:true,
		icon:'face-sad'
	});
}
</script>
<div id="container" class="so_main">
<link rel="stylesheet" type="text/css" href="<?php echo __CONTENT__;?>/Admin/css/uploadify.css">
	<div class="page_tit"><?php echo $title;?></div>
	<!-- START CONFIG_FORM -->
	<form method="POST" action="">
	<?php if(isset($_GET['id'])){?>
	<input type="hidden" name="id" value="<?php echo intval($_GET['id']);?>" />
	<?php }?>
		<div class="form2">
			<dl class="lineD">
				<dt>
					<font color="red">*</font>图片：
				</dt>
				<dd>
					<input type="file" id="thumbnail" />
					<div id="show-thumbnail">
					<?php if(isset($info)){?>
						<img src="<?php echo __UPLOAD__;?>/<?php echo $info['img'];?>" width="150" /> 
						<a href="#" id="delete-thumbnail">删除</a>
					<?php }?>
					</div>
					<input type="hidden" name="img" value="<?php if(isset($info['img'])&&$info['img']!=''){echo $info['img'];}else{echo '';}?>" />
				</dd>
			</dl>
			<dl class="lineD">
				<dt>
					超链接：
				</dt>
				<dd>
					<input name="href" maxlength="255" type="text" value="<?php if(isset($info['href'])&&$info['href']!=''){echo $info['href'];}else{echo '#';}?>" class="s-big-txt">
					<font color="red">*超链接请保持http://开发,如:http://www.baidu.com,如果没有超链接请填写#</font>
				</dd>
			</dl>
			<dl class="lineD">
				<dt>
					<font color="red">*</font>排序：
				</dt>
				<dd>
					<input name="sort" maxlength="6" type="text" value="<?php if(isset($info['sort'])&&$info['sort']!=''){echo $info['sort'];}else{echo '50';}?>" class="s-small-txt">
					<font color="red">*升序排列</font>
				</dd>
			</dl>
			<div class="page_btm">
				<input type="submit" class="btn_b" value="保存"  />
			</div>
		</div>
	</form>
	<!-- END CONFIG_FORM -->
</div>
<script type="text/javascript" src="<?php echo __CONTENT__;?>/Admin/js/jquery.uploadify.min.js"></script>
<script type="text/javascript">
$(function(){
	setTimeout(function(){
		$('#thumbnail').uploadify({
			swf      : '<?php echo __CONTENT__;?>/swf/uploadify.swf',
			uploader : '<?php echo U('Public/upload');?>',
			buttonText:"上传缩略图",
			fileTypeDesc : '图片文件',
			fileTypeExts : '*.gif; *.jpg; *.png;*.jpeg',
			height:25,
			width:100,
			multi:false,
			onUploadSuccess : function(file, data, response) {
				data=eval('('+data+')');
				if(data.status==true){
					$("#show-thumbnail").html('<img src="<?php echo __UPLOAD__;?>/'+data.fileInfo.savename+'" width="150" /> <a href="#" id="delete-thumbnail">删除</a>');
					$("input[name='img']").val(data.fileInfo.savename);
				}else{
					alert(data.error_message);
				}
	        }
		});
	},10)
	$(document).on("click","#delete-thumbnail",function(){
		$("#show-thumbnail").empty();
		$("input[name='img']").val('');
	});
});
</script>
</html>